package com.wanxi.story;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        Map<Husband,Wife> map=new HashMap<>();
//        entry对象
        Husband zs1 = new Husband("张三1");
        Husband zs2 = new Husband("张三2");
        Husband zs3 = new Husband("张三3");
        map.put(zs1,new Wife("张三11"));
        map.put(zs2,new Wife("张三12"));
        map.put(zs3,new Wife("张三13"));
//        for (int i = 0; i < map.size(); i++) {
//        }
//        for(Husband h:map.keySet()){
//            Wife wife = map.get(h);
//            System.out.println(h.getName()+"-------"+wife.getName());
//        }
        Set<Map.Entry<Husband, Wife>> sets = map.entrySet();
        for (Map.Entry<Husband, Wife> aa:sets
             ) {
            System.out.println(aa.getKey().getName()+"--"+aa.getValue().getName());
        }
//        for (int i = 0; i < sets.size(); i++) {
//
//        }


    }
}
